'\" te
.\" Copyright (c) 2002, Sun Microsystems, Inc. All Rights Reserved.
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH STACK_SETBOUNDS 3C "Jul 18, 2002"
.SH NAME
stack_setbounds \- update stack boundaries
.SH SYNOPSIS
.LP
.nf
#include <ucontext.h>

\fBint\fR \fBstack_setbounds\fR(\fBconst stack_t *\fR\fIsp\fR);
.fi

.SH DESCRIPTION
.sp
.LP
The \fBstack_setbounds()\fR function updates the current base and bounds of the
stack for the current thread to the bounds specified by the \fBstack_t\fR
structure pointed to by \fIsp\fR. The \fBss_sp\fR member refers to the virtual
address of the base of the stack memory. The \fBss_size\fR member refers to the
size of the stack in bytes. The \fBss_flags\fR member must be set to 0.
.SH RETURN VALUES
.sp
.LP
Upon successful completion, \fBstack_setbounds()\fR returns 0. Otherwise, \(mi1
is returned and \fBerrno\fR is set to indicate the error.
.SH ERRORS
.sp
.LP
The \fBstack_setbounds()\fR function will fail if:
.sp
.ne 2
.na
\fB\fBEFAULT\fR\fR
.ad
.RS 10n
The \fIsp\fR argument does not refer to a valid address or the \fBss_sp\fR
member of the \fBstack_t\fR structure pointed to by \fIsp\fR points to an
illegal address.
.RE

.sp
.ne 2
.na
\fB\fBEINVAL\fR\fR
.ad
.RS 10n
The \fBss_sp\fR member of the \fBstack_t\fR structure pointed to by sp is not
properly aligned, the \fBss_size\fR member is too small or is not properly
aligned, or the \fBss_flags\fR member is non-zero.
.RE

.SH USAGE
.sp
.LP
The \fBstack_setbounds()\fR function is intended for use by applications that
are managing their own alternate stacks.
.SH ATTRIBUTES
.sp
.LP
See \fBattributes\fR(7) for descriptions of the following attributes:
.sp

.sp
.TS
box;
c | c
l | l .
ATTRIBUTE TYPE	ATTRIBUTE VALUE
_
Interface Stability	Evolving
_
MT-Level	Async-Signal-Safe
.TE

.SH SEE ALSO
.sp
.LP
.BR getustack (2),
.BR _stack_grow (3C),
.BR stack_getbounds (3C),
.BR stack_inbounds (3C),
.BR stack_violation (3C),
.BR attributes (7)
